package guava;

import com.google.common.util.concurrent.RateLimiter;

import java.time.LocalDateTime;

/**
 * @author chedx
 * @data 2021/3/21 11:06 AM
 */
public class TestMain {
    public static void main(String[] args) {
        RateLimiter rateLimiter = RateLimiter.create(2);
        for (int i = 0; i < 6; i++) {
            new Thread(()-> {
                rateLimiter.acquire();
                System.out.println(LocalDateTime.now());
            }).start();
        }
    }
}
